import 'package:dodoclub/pages/index/index_page.dart';
import 'package:dodoclub/pages/summary/summary_page.dart';
import 'package:dodoclub/pages/square/square_page.dart';
import 'package:dodoclub/pages/settings/settings_page.dart';
import 'package:flutter/material.dart';

class MainPage extends StatefulWidget {
  const MainPage({Key? key}) : super(key: key);

  @override
  State<MainPage> createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  final List pages = [
    const IndexPage(),
    SquarePage(),
    MessagePage(),
    const PersonPage()
  ];
  int _selectedIndex = 0;

  void onTap(int index) {
    setState(() {
      _selectedIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: pages[_selectedIndex],
      bottomNavigationBar: BottomNavigationBar(
        items: const [
          BottomNavigationBarItem(
            icon: Icon(Icons.home), //home),
            label: 'Index',
          ),
          BottomNavigationBarItem(
              icon: Icon(Icons.call_split), label: 'Square'),
          BottomNavigationBarItem(
              icon: Icon(Icons.all_inclusive), label: 'Summary'),
          BottomNavigationBarItem(
              icon: Icon(Icons.settings_backup_restore_sharp),
              label: 'Settings')
        ],
        currentIndex: _selectedIndex,
        selectedItemColor: const Color(0xff7de93b), //Colors.orange,
        unselectedItemColor: Colors.grey.withOpacity(0.5),
        showSelectedLabels: false,
        showUnselectedLabels: false,
        elevation: 0,
        onTap: onTap,
      ),
    );
  }
}
